UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RGvCsPV9T6ZH+sUro7cHFeD/ykPDb+9cNKxB97Ga3Zg='
WHERE
key_id = 'da0116c8d51b5e33bf60604a85cac05829b23eb62f59cd4eb45a83326b38af95'
AND (
token = 'RGvCsPV9T6ZH+sUro7cHFeD/ykPDb+9cNKxB97Ga3Zg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)