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