UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CaLIG6xnKwcPj3faldZSmmJuq8/5hnd3eQ/cAWpM+rQ='
WHERE
key_id = 'de877e65c8c042fb3ad0681cd6e183313ddcd03fe9ab1858a759bbde550771b1'
AND (
token = 'CaLIG6xnKwcPj3faldZSmmJuq8/5hnd3eQ/cAWpM+rQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)