UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ttnC3UOXSGoK67tempMBJx6DwjZeSI457EreFBKtCQ4=' 
WHERE 
  key_id = '4007a30d962f844be90fc282a5255c9936f6fab419803264be9f3ad78fa004a6' 
  AND (
    token = 'ttnC3UOXSGoK67tempMBJx6DwjZeSI457EreFBKtCQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033