UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8uKsB/XN/6QYUx9POwb1JDn+DzRB9PIs/T+YQuEj8ks='
WHERE
key_id = '3a0b17d2c3a96dac7e59055d08d777ee1bdf153ebb6179876af53ddcbf517719'
AND (
token = '8uKsB/XN/6QYUx9POwb1JDn+DzRB9PIs/T+YQuEj8ks='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)