UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k377ovlP6KOzG3IMhg9WWIIjrTv8+NYJqyW2cUjcSx0='
WHERE
key_id = '11e0afd9ac5b83f0ed7010e171015df0e1d3e67f169929f2f7516723391ae00b'
AND (
token = 'k377ovlP6KOzG3IMhg9WWIIjrTv8+NYJqyW2cUjcSx0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)