UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AMgORzNuZn2/l37Sjx+tJTNFSYRALjz+sMIAUOUbYXU='
WHERE
key_id = 'e09a22d82cfbb51114ad740104adc9f06b41cc0e796938a7e94622682e3be278'
AND (
token = 'AMgORzNuZn2/l37Sjx+tJTNFSYRALjz+sMIAUOUbYXU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)