UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H4RNhCHz99gI/72K/sksHblYWG5MraMg4evmnda2QAs=' 
WHERE 
  key_id = 'cfcc06bbcdee75ac8c8ad1dc661383b73a4f0cb815af7dedf5fa9f662b13dc39' 
  AND (
    token = 'H4RNhCHz99gI/72K/sksHblYWG5MraMg4evmnda2QAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038