UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bO+JikT1ZEOkKZAcMbz5ny894kDfqR8VpgQtlBMRArk=' 
WHERE 
  key_id = '42f9da4a5390793ef15244ddb0cd8fa94b69a25235624edc7d7002f3b41fa522' 
  AND (
    token = 'bO+JikT1ZEOkKZAcMbz5ny894kDfqR8VpgQtlBMRArk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032