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