UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7P7idfmcx9Thy3XKx1EGWoiJDwiNcwy6p3Fa1oO4JDs='
WHERE
key_id = 'b39bf3e86e40d8262131ec4236db3b7c0289755381f36e1bf23e091097f29c94'
AND (
token = '7P7idfmcx9Thy3XKx1EGWoiJDwiNcwy6p3Fa1oO4JDs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)