UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SZqBQvUf/IhXkwF65vDnjpv4+tqlfTbu1NgViX2Jphk='
WHERE
key_id = 'e8245aadee6b7632b64e3da4043e551e1e09229a8f4c491fb92f06a01ab2963d'
AND (
token = 'SZqBQvUf/IhXkwF65vDnjpv4+tqlfTbu1NgViX2Jphk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)