UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YSPLLUoMoQXZkKj98MbJ11UchSD91h5cZtJe2+M7CHM='
WHERE
key_id = '869782a820fc0f113c0870019cc5daf3c292d4c6da36c169c047ecb28c6cf0b8'
AND (
token = 'YSPLLUoMoQXZkKj98MbJ11UchSD91h5cZtJe2+M7CHM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)