UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'THs4KTHAFxio4HgfUIAOpuKVSQ1Vfw/np3bmpHr9Xdg=' 
WHERE 
  key_id = '945bd43ddfad88d5c21eac3c36ecad26a9f08ec98e9d2710b701052adf03ed1b' 
  AND (
    token = 'THs4KTHAFxio4HgfUIAOpuKVSQ1Vfw/np3bmpHr9Xdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031