UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yYJQ2GNnaTO2lvbiu4Y1jb1wuw4AWEMYqaShlMrRHAU=' 
WHERE 
  key_id = '54d9799bfc1dee888d1dc28140f449ab015eb81696c8c9fc7c956200b45cb248' 
  AND (
    token = 'yYJQ2GNnaTO2lvbiu4Y1jb1wuw4AWEMYqaShlMrRHAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042