UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M0BEv7gdW0bpnSVCWuChU3EwmJWI1myOTAh7H36BI2Q='
WHERE
key_id = 'deb6ad6ddc17a42e5e544c9eee2c93922584cdaa859ed8b09d487d8e41ee6260'
AND (
token = 'M0BEv7gdW0bpnSVCWuChU3EwmJWI1myOTAh7H36BI2Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)