UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sa3bbsLz7khvE7aXl5MMJ5mqm4Phc7a0+cFwW+6O+e8='
WHERE
key_id = 'cfe53f147ffa3a8bb7fd616854fd0956be97be3207bfe3c9cc48a719f83d9501'
AND (
token = 'Sa3bbsLz7khvE7aXl5MMJ5mqm4Phc7a0+cFwW+6O+e8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)