UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iZplObuHWdXhuQVPMVvdKam/fE13ErNTw6ZzWF1ltms=' 
WHERE 
  key_id = 'd04af8b5ead8818fee4c18b0ffaae0ec0e2391733c56670576c27c63a5b65877' 
  AND (
    token = 'iZplObuHWdXhuQVPMVvdKam/fE13ErNTw6ZzWF1ltms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036