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