UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HMt9wf5ag8CF8+wCITlgid5bw51Luj9Z1nOHnmGWrIQ=' 
WHERE 
  key_id = '24ceee6262cf194aa32650d3c0554f9f2ebff672ed7115a7e6468fdc9b2f265f' 
  AND (
    token = 'HMt9wf5ag8CF8+wCITlgid5bw51Luj9Z1nOHnmGWrIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024