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

Query time 0.00039