UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9pPG2g9TAP88fKC5EWzhsuoCkCt90APQapgGkp8TmvA='
WHERE
key_id = 'e8070d2ef2183e88f8794fd0f92147975faa7e788afdbee9102224310460e2af'
AND (
token = '9pPG2g9TAP88fKC5EWzhsuoCkCt90APQapgGkp8TmvA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)