UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lrvGedm+5nPgtT4WlFDP8Hu9CYMlFpov3x7d4BMEtVY=' 
WHERE 
  key_id = '29ab7d6d0e161dcb06f8356e9f8e4be388ee8b61b219b10fd0470c71726d847b' 
  AND (
    token = 'lrvGedm+5nPgtT4WlFDP8Hu9CYMlFpov3x7d4BMEtVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039