UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MkJ4L8cY95d+EcgoAN4i5LnANZP+bKR+03guSmOANmA=' 
WHERE 
  key_id = '19199759376a577997b9bdd982013ce9f84ab40a15111436b09111a47326e55b' 
  AND (
    token = 'MkJ4L8cY95d+EcgoAN4i5LnANZP+bKR+03guSmOANmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036