UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9lFcgGnwqiP0dnR1y/Iyw4X/GHhfur9a6tQV6SuAmbs=' 
WHERE 
  key_id = 'a64a7b91478d9dab5a93713c763ebe04795a9b0a869bf02a19c7a6bfa743340d' 
  AND (
    token = '9lFcgGnwqiP0dnR1y/Iyw4X/GHhfur9a6tQV6SuAmbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024