UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HHoSISrjU3Z9WAxvWC77jvXYrKuNetJTxy731hxRrms='
WHERE
key_id = 'c88a9d81542b8badff0060b4a696d583f1232de98e3ece610ec5faab640f7ed8'
AND (
token = 'HHoSISrjU3Z9WAxvWC77jvXYrKuNetJTxy731hxRrms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)