UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JiRIM2fvTqbKAOgACRSvchdUlwLEAqvfvdGGv2HhgMY='
WHERE
key_id = '54e3ebd966a6847fcb9043d79cb990d569d3b147c5a1099817248afb51436e22'
AND (
token = 'JiRIM2fvTqbKAOgACRSvchdUlwLEAqvfvdGGv2HhgMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)