UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tS4F0Xcw5M19XRyk5PHcBn0SWpyKD33lWMDUyOWE86U=' 
WHERE 
  key_id = '2641ec7d6c95b076c8be2b70f1864415f027be2d7a71e084771997ac82886275' 
  AND (
    token = 'tS4F0Xcw5M19XRyk5PHcBn0SWpyKD33lWMDUyOWE86U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029