UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B90MZA+ph1ieYUZktZvkhi9MQsxHgfpyulpBcslqX8g=' 
WHERE 
  key_id = 'd0482c60fa66d1bef1352ad46399bbed313bf27bfa211bf081b366e150370787' 
  AND (
    token = 'B90MZA+ph1ieYUZktZvkhi9MQsxHgfpyulpBcslqX8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016