UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gSS9YP2+OEHGDVWoreFYP+LOzpON8ZflWW1qmTptqC0='
WHERE
key_id = 'ef7b5033ba24a95b7b24e56846ff07eeae72967eafdfe6a722905979a7f7b61d'
AND (
token = 'gSS9YP2+OEHGDVWoreFYP+LOzpON8ZflWW1qmTptqC0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)