UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KXUda+sxboVEAdst+glIY6CUFMCGpmuwlN+0pCLOPoU='
WHERE
key_id = '5a9e2f8e43d09471d522f46fac38c3383cdbe917ebd99562f840a480a85e006d'
AND (
token = 'KXUda+sxboVEAdst+glIY6CUFMCGpmuwlN+0pCLOPoU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)