UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vzIY3Q6JTu9i0gFd5EW0Zy6ZEy40PKqzePVoKfH7oSI='
WHERE
key_id = '37e2c893bbaabec9a226e9ac28e88f847b7c784e800b025c4f6591161ee939c6'
AND (
token = 'vzIY3Q6JTu9i0gFd5EW0Zy6ZEy40PKqzePVoKfH7oSI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)