UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ThNqhCVLedOWFflAf72bph/21OJbgUzUEbycjYqO2wo=' 
WHERE 
  key_id = 'f673fbc6a49f1512321ba31d805c243d061b3a1618a9a10582dcb582d1da879c' 
  AND (
    token = 'ThNqhCVLedOWFflAf72bph/21OJbgUzUEbycjYqO2wo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034