UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kJNdS890M9ERXjIT+r5f+yLt7neSSCkpTluE7NnRz5c=' 
WHERE 
  key_id = 'cbd27139f5a0f090207a4f872f1b278b9820d3866d76f30b3d95091b9f7effa3' 
  AND (
    token = 'kJNdS890M9ERXjIT+r5f+yLt7neSSCkpTluE7NnRz5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027