UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TrYb+d5zjo5qiqmm9W1qU6HPbFc5dwP5qhgANHvwan4='
WHERE
key_id = '574b06005dd442ae0d193a70ea509af09f8fc6268aba3a2a2b98a0126047a2d7'
AND (
token = 'TrYb+d5zjo5qiqmm9W1qU6HPbFc5dwP5qhgANHvwan4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)