UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r2UGH7jM9Bl3ptOZoPcXR6YlEAZxcnIjtClZEXNH4ls=' 
WHERE 
  key_id = 'd13d5c706ff3947dc5882fc5bc1f398daa3b0b116240f85c8497bb49ed8a8662' 
  AND (
    token = 'r2UGH7jM9Bl3ptOZoPcXR6YlEAZxcnIjtClZEXNH4ls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021