UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZJPc75WSme2FoL98OLHLXgXvAnvSrkMk8R9Q6I4aRwo='
WHERE
key_id = '1388d227b461bb6c4dbd5b6f6586f42569f0c082734d83d2497cc7aab8760897'
AND (
token = 'ZJPc75WSme2FoL98OLHLXgXvAnvSrkMk8R9Q6I4aRwo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)