UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tx7bqF1Cpgdv9ZEkiFiMoMjBVUxzz8VuSmU+TyJIpFE=' 
WHERE 
  key_id = '643d661d20702020056bda34bbd689320a283a88ff69d5101e8af9c9db7184f9' 
  AND (
    token = 'tx7bqF1Cpgdv9ZEkiFiMoMjBVUxzz8VuSmU+TyJIpFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029