UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'msZTo2BDaIAEPUoYVrd3vXGvUWI1IgYdnZf0s8KFUes='
WHERE
key_id = '865d04acef21e83ffd508cd6390f3fe64d3bb1fa6f860aaf3f49ad6da16253a6'
AND (
token = 'msZTo2BDaIAEPUoYVrd3vXGvUWI1IgYdnZf0s8KFUes='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)