UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rr0kR8dcn3AojSGdNXm+V81dT53LeQ5Che9vJo5YLBM=' 
WHERE 
  key_id = '6655d6f44a8bd7acf9295b6db2fcadf9aa97694115798a55e86be3c276238172' 
  AND (
    token = 'rr0kR8dcn3AojSGdNXm+V81dT53LeQ5Che9vJo5YLBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042