UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hTEAjSy9T2pjBg0DlueoTCN31iawjxc/z05symoBm8o=' 
WHERE 
  key_id = '321eaa18de74a863ee252ffc56daf4dcf3dcbc82924ca66c34c4061f210412d4' 
  AND (
    token = 'hTEAjSy9T2pjBg0DlueoTCN31iawjxc/z05symoBm8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016