UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CmM2rdR0XvjP4W5EprxaItDMiF9OAq5WEUNKDoKiGo4=' 
WHERE 
  key_id = '34f1abc5cca7a73ea2e17c234f303a79ac943c45e9439b305a13721aa9be9202' 
  AND (
    token = 'CmM2rdR0XvjP4W5EprxaItDMiF9OAq5WEUNKDoKiGo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018