UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M2zffOiCkISWNFYVqVdzt+UCqRRIrRVGgyG9kN8cDZU=' 
WHERE 
  key_id = '12919d918683fb703a5ffeb4ea8b56edb1c984cda16f14186cde86335d05a742' 
  AND (
    token = 'M2zffOiCkISWNFYVqVdzt+UCqRRIrRVGgyG9kN8cDZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042