UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VdQS/rMEJj+vsAnxXRShnh611R1QinDkT+U8UarjGaI=' 
WHERE 
  key_id = '70067948cd57078e574857b664246f0758884daff572639e161cd48c4718df0a' 
  AND (
    token = 'VdQS/rMEJj+vsAnxXRShnh611R1QinDkT+U8UarjGaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016