UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JWABnzIrCEV0DGldDjLOas70F5+C9t8nSXNEDZptBPQ=' 
WHERE 
  key_id = 'ffc85082405895420e9082262c447fa6742442641c54d181b3fabb9469d4e51a' 
  AND (
    token = 'JWABnzIrCEV0DGldDjLOas70F5+C9t8nSXNEDZptBPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026