UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Itk8j8UQktXd0QmKNLT4h4/uNePfLr63UCq8qF4cP6w=' 
WHERE 
  key_id = 'ae8c063c345248750d2980e9347f737d1c4121be3ee231e1580fbe9576621e72' 
  AND (
    token = 'Itk8j8UQktXd0QmKNLT4h4/uNePfLr63UCq8qF4cP6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025