UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J67zmHGh02QEXLaNv+eBTkCA5L8I8EBkow2oCiH4LZc='
WHERE
key_id = 'e261d8309afe904c507ce691087ee95b9b1cdfcafb39f85be984e2188a6cc239'
AND (
token = 'J67zmHGh02QEXLaNv+eBTkCA5L8I8EBkow2oCiH4LZc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)