UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vIgwjnLeSwVidiLRCLquCSzKi1aHPqdOwD18p3FlOIM=' 
WHERE 
  key_id = 'cd61298f7c7b7e9de4ebb08e0a51421c0405d03be9766b23ef90c635d9c28046' 
  AND (
    token = 'vIgwjnLeSwVidiLRCLquCSzKi1aHPqdOwD18p3FlOIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046