UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4O3vRbimYH9iQMTAWgbvJAAYQWPVgzVe0XNaquYEA5g='
WHERE
key_id = 'a9476e62c9e16619b43ee4bd849edf63c1eb7dee69a044356283b8d0bf9472d7'
AND (
token = '4O3vRbimYH9iQMTAWgbvJAAYQWPVgzVe0XNaquYEA5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)