UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6C8a0JF4MqmDQkpTrQrWWdxLHrvNPNSHL6RvynsOvYs=' 
WHERE 
  key_id = '8670d759ff253cee5a1ed36c3a97229c4a2415c579fea24bf00884ee7002651e' 
  AND (
    token = '6C8a0JF4MqmDQkpTrQrWWdxLHrvNPNSHL6RvynsOvYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033