UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BgDHUXWXfxJMwjKKPZahAjrNpaOx8pdR4m8xzOWDAS8='
WHERE
key_id = '707991f6a7a9677ff3f3e5d4c17ad1ca36dd07b12e851aa46a4fa1ab9423a174'
AND (
token = 'BgDHUXWXfxJMwjKKPZahAjrNpaOx8pdR4m8xzOWDAS8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)