UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qHTiSyof1MLDiTq7dQGs9qG1HsNe+rV31hSydXcwpfI='
WHERE
key_id = 'd6763c0fb7546a844a75f3e3d43a1ad414e220dcf1bccabf7b14409232fee57b'
AND (
token = 'qHTiSyof1MLDiTq7dQGs9qG1HsNe+rV31hSydXcwpfI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)