UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KljYPopQQmFMHw+8nat9cm5zKZ4YdTUCzXpCZCygZdM='
WHERE
key_id = '05b87ee1c75a8b96ff3792b16d0b4a84013b72c1f4b59b9c6ca725a9725044f2'
AND (
token = 'KljYPopQQmFMHw+8nat9cm5zKZ4YdTUCzXpCZCygZdM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)