UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7xze8LEyIo3Oo6KZabTNo+qToBUntCU3tzDZYuA+dKw='
WHERE
key_id = '4d2a182244fb0a63d441adf4307da9f297f5050a2039ca47d636d1c6a64bfde8'
AND (
token = '7xze8LEyIo3Oo6KZabTNo+qToBUntCU3tzDZYuA+dKw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)