UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6RMPU78O3tznH4hRQAZZkuVOvMip7G7gZqQ0OyTUEDs='
WHERE
key_id = 'ea91216133e7027269315c11d236c5c8ed092c883b0afbca198b061178bf3372'
AND (
token = '6RMPU78O3tznH4hRQAZZkuVOvMip7G7gZqQ0OyTUEDs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)