UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PCVME5vyoWyjgDIAX2FBO3FMFFfGiN8km0k2ersINmo='
WHERE
key_id = '6718c7ecf1bbc61d31794a914d42b2e5dfe2340fcc4611b869318e34d06806d9'
AND (
token = 'PCVME5vyoWyjgDIAX2FBO3FMFFfGiN8km0k2ersINmo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)