UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YO9RYqpVjXCOgcMMkcXRuYAqvGYvWJhZ9/FxGyl1jrw=' 
WHERE 
  key_id = 'db742930a151f0040ea5f0393804683271061595874ce68f786fe7d2777aa3a7' 
  AND (
    token = 'YO9RYqpVjXCOgcMMkcXRuYAqvGYvWJhZ9/FxGyl1jrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047