UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ByNtH1mfV1NpudqeNjTlUR1ASjgEib02IZqTMYUcs0M='
WHERE
key_id = 'c5c533b16717451981372ca1a2808654a6aa79d2be39ad4ad0d1a68f819ae174'
AND (
token = 'ByNtH1mfV1NpudqeNjTlUR1ASjgEib02IZqTMYUcs0M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)