UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AVcLB0XWUQn8HZIBiNgO7KwtKWu970j0wjvAqBdMZK4='
WHERE
key_id = '9e525f6652cbbc1387124f7bee4ac57b6a44ae5b6d011119a84608482f420f57'
AND (
token = 'AVcLB0XWUQn8HZIBiNgO7KwtKWu970j0wjvAqBdMZK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)