UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gQB76NiyxqdJ5CsiNz9ZBxQ8bJUT+0J9XerlkxSzWx4=' 
WHERE 
  key_id = '1291e889e7fd99f39402979ff05c0adfda9ba877ca9654b0fec4a45cc4b56732' 
  AND (
    token = 'gQB76NiyxqdJ5CsiNz9ZBxQ8bJUT+0J9XerlkxSzWx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022